import { defineComponent } from 'vue';
import WrapTitle from '@common/wrapTitle';

export interface TechAnalysis {
  name: string;
  count: number;
  ratio: number;
}
export default defineComponent({
  name: 'TechAnalysis',
  props: {
    data: Array,
  },
  render(props: any) {
    return (
      <>
        <WrapTitle title="技术构成分析"></WrapTitle>

        {props.data?.length > 0 ? (
          <ul id="TechAnalysis">
            {new Array(6)
              .fill({
                cnt: '-',
                code: '-',
                desc: '-',
              })
              .map((d, index: any) => {
                const item = props.data[index] || d;
                return (
                  <li class={index % 2 ? 'dark' : 'light'}>
                    <b>{index + 1}</b>

                    <p>{item.code}</p>

                    <p class="count">
                      {item.cnt}
                      <span> 件专利</span>
                    </p>

                    <p>{item.desc}</p>
                  </li>
                );
              })}
          </ul>
        ) : (
          <div class="card_null">
            <img src={require('@assets/img_null.png')} width={56} height={74} />
          </div>
        )}
      </>
    );
  },
});
